<?php
declare(strict_types=1);
namespace Field;

class SysUserBonusLogConst
{
    public const pk='BonusID';
    public const index=['BonusID'];
	public const fields=['BonusID','UserID','ParentUserID','FromUserID','TypeID','Channel','Bonus','CreateAt','Status','FrozenAt','FrozenY','FrozenYm','FrozenYmd','CashID','AuthTime','OrderID','Remak'];
	public const comment=['BonusID'=>'id','UserID'=>'UID','ParentUserID'=>'推荐人','FromUserID'=>'来源用户','TypeID'=>'类型 10收入 20支出','Channel'=>'类型','Bonus'=>'金额','CreateAt'=>'时间','Status'=>'0未生效 1有效 2取消 3退款 4冻结','FrozenAt'=>'可用时间','FrozenY'=>'可用年','FrozenYm'=>'可用年月','FrozenYmd'=>'可用年月日','CashID'=>'提现单号','AuthTime'=>'时间','OrderID'=>'订单号','Remak'=>'备注'];
	/*
    * @Field BonusID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra auto_increment
    * @Privileges select,insert,update,references
    * @Comment id
    */
    public const BonusID = 'BonusID';
    /*
    * @Field UserID
    * @Type int(11)
    * @Collation 
    * @Null NO
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment UID
    */
    public const UserID = 'UserID';
    /*
    * @Field ParentUserID
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 推荐人
    */
    public const ParentUserID = 'ParentUserID';
    /*
    * @Field FromUserID
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 来源用户
    */
    public const FromUserID = 'FromUserID';
    /*
    * @Field TypeID
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 类型 10收入 20支出
    */
    public const TypeID = 'TypeID';
    /*
    * @Field Channel
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 类型
    */
    public const Channel = 'Channel';
    /*
    * @Field Bonus
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 金额
    */
    public const Bonus = 'Bonus';
    /*
    * @Field CreateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default CURRENT_TIMESTAMP
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 时间
    */
    public const CreateAt = 'CreateAt';
    /*
    * @Field Status
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 0未生效 1有效 2取消 3退款 4冻结
    */
    public const Status = 'Status';
    /*
    * @Field FrozenAt
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 可用时间
    */
    public const FrozenAt = 'FrozenAt';
    /*
    * @Field FrozenY
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 可用年
    */
    public const FrozenY = 'FrozenY';
    /*
    * @Field FrozenYm
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 可用年月
    */
    public const FrozenYm = 'FrozenYm';
    /*
    * @Field FrozenYmd
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 可用年月日
    */
    public const FrozenYmd = 'FrozenYmd';
    /*
    * @Field CashID
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 提现单号
    */
    public const CashID = 'CashID';
    /*
    * @Field AuthTime
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 时间
    */
    public const AuthTime = 'AuthTime';
    /*
    * @Field OrderID
    * @Type char(20)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key MUL
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 订单号
    */
    public const OrderID = 'OrderID';
    /*
    * @Field Remak
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 备注
    */
    public const Remak = 'Remak';
}

class SysUserBonusLogColumns
{
public  int $BonusID;
   public  int $UserID;
   public  int $ParentUserID=0;
   public  int $FromUserID=0;
   public  int $TypeID=0;
   public  int $Channel=0;
   public  int $Bonus=0;
   public  ?string $CreateAt='';
   public  int $Status=0;
   public  int $FrozenAt=0;
   public  int $FrozenY=0;
   public  int $FrozenYm=0;
   public  int $FrozenYmd=0;
   public  int $CashID=0;
   public  int $AuthTime=0;
   public  ?string $OrderID='';
   public  ?string $Remak='';
	public function toArray():array
	{
		return [
'BonusID'=>$this->BonusID,
    'UserID'=>$this->UserID,
    'ParentUserID'=>$this->ParentUserID,
    'FromUserID'=>$this->FromUserID,
    'TypeID'=>$this->TypeID,
    'Channel'=>$this->Channel,
    'Bonus'=>$this->Bonus,
    'CreateAt'=>$this->CreateAt,
    'Status'=>$this->Status,
    'FrozenAt'=>$this->FrozenAt,
    'FrozenY'=>$this->FrozenY,
    'FrozenYm'=>$this->FrozenYm,
    'FrozenYmd'=>$this->FrozenYmd,
    'CashID'=>$this->CashID,
    'AuthTime'=>$this->AuthTime,
    'OrderID'=>$this->OrderID,
    'Remak'=>$this->Remak,        ];
	}
}

class SysUserBonusLogRow
{
	public SysUserBonusLogColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'BonusID' => $this->data->BonusID,
        'UserID' => $this->data->UserID,
        'ParentUserID' => $this->data->ParentUserID,
        'FromUserID' => $this->data->FromUserID,
        'TypeID' => $this->data->TypeID,
        'Channel' => $this->data->Channel,
        'Bonus' => $this->data->Bonus,
        'CreateAt' => $this->data->CreateAt,
        'Status' => $this->data->Status,
        'FrozenAt' => $this->data->FrozenAt,
        'FrozenY' => $this->data->FrozenY,
        'FrozenYm' => $this->data->FrozenYm,
        'FrozenYmd' => $this->data->FrozenYmd,
        'CashID' => $this->data->CashID,
        'AuthTime' => $this->data->AuthTime,
        'OrderID' => $this->data->OrderID,
        'Remak' => $this->data->Remak, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new SysUserBonusLogColumns();
        isset($data['BonusID']) && $this->data->BonusID = (int)$data['BonusID'];
           isset($data['UserID']) && $this->data->UserID = (int)$data['UserID'];
           isset($data['ParentUserID']) && $this->data->ParentUserID = (int)$data['ParentUserID'];
           isset($data['FromUserID']) && $this->data->FromUserID = (int)$data['FromUserID'];
           isset($data['TypeID']) && $this->data->TypeID = (int)$data['TypeID'];
           isset($data['Channel']) && $this->data->Channel = (int)$data['Channel'];
           isset($data['Bonus']) && $this->data->Bonus = (int)$data['Bonus'];
           isset($data['CreateAt']) && $this->data->CreateAt = (string)$data['CreateAt'];
           isset($data['Status']) && $this->data->Status = (int)$data['Status'];
           isset($data['FrozenAt']) && $this->data->FrozenAt = (int)$data['FrozenAt'];
           isset($data['FrozenY']) && $this->data->FrozenY = (int)$data['FrozenY'];
           isset($data['FrozenYm']) && $this->data->FrozenYm = (int)$data['FrozenYm'];
           isset($data['FrozenYmd']) && $this->data->FrozenYmd = (int)$data['FrozenYmd'];
           isset($data['CashID']) && $this->data->CashID = (int)$data['CashID'];
           isset($data['AuthTime']) && $this->data->AuthTime = (int)$data['AuthTime'];
           isset($data['OrderID']) && $this->data->OrderID = (string)$data['OrderID'];
           isset($data['Remak']) && $this->data->Remak = (string)$data['Remak'];
    }
}
?>